package org.lboot.flow.module.process;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.Hibernate;
import org.lboot.jpa.entity.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * @author kindear
 * 流程流转记录
 *
 */
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "flow_process")
@ApiModel(value = "流程流转")
public class FlowProcess extends BaseEntity implements Serializable {

//    @Id
//    @GenericGenerator(name = "id",strategy = "com.lucy.starter.generator.SnowIdGenerator")
//    @GeneratedValue(generator = "id")
//    @ApiModelProperty(value = "雪花ID",name = "id")
//    protected String id;

    @ApiModelProperty(value = "流程实例ID")
    @Column(name = "flow_work_id")
    String flowWorkId;

    @ApiModelProperty(value = "流转起始点")
    @Column(name = "from_node")
    String fromNode;

    @ApiModelProperty(value = "流转结束点")
    @Column(name = "to_node")
    String toNode;

//
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
//    @ApiModelProperty(value = "记录创建时间",name = "createdTime")
//    @Column(name = "created_time")
//    protected Date createdTime;
//
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
//    @ApiModelProperty(value = "记录更新时间",name = "updatedTime")
//    @Column(name = "updated_time")
//    protected Date updatedTime;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        FlowProcess that = (FlowProcess) o;
        return id != null && Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return getClass().hashCode();
    }
}
